/*通用js*/

var common = {
    // url集合 统一处理
    URL: {
        getSystemsUrl: "/systemAdmin/getSystems"
    },
    /**
     *@description 获取系统id和名称 并拼接到下拉框
     *@author XieXing
     *@date 2020/11/18 18:14
     */
    getSystems: function (selectId,defaultValue) {
        $.post(common.URL.getSystemsUrl, {}, function (result) {
            if (result.code == 200) {
                var data = result.data;
                var str = "<option value=''>请选择所属系统</option>";
                for (var i = 0; i < data.length; i++) {
                    if(data[i].id == defaultValue){
                        str += "<option value='" + data[i].id + "' selected>" + data[i].sysName + "</option>";
                    }else{
                        str += "<option value='" + data[i].id + "'>" + data[i].sysName + "</option>";
                    }
                }
                $("#" + selectId).empty();//清空下拉框
                $("#" + selectId).html(str);//给下拉框重新赋值
                form.render();
            } else {
                layer.msg("获取系统失败", {icon: 2, time: 2000});
                return false;
            }
        })
    }
};